/*******************************************************************************
 * Copyright 2011-2012 Dik Grapendaal
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 ******************************************************************************/
package sh.grapendaal.tsuushin.service;

import java.io.File;
import java.io.IOException;

import javax.xml.bind.JAXBException;

import org.xml.sax.SAXException;

import sh.grapendaal.tsuushin.binding.config.IRCBot;

/**
 * The Config Service deals with configuration. It currently only loads the XML
 * configuration of the host application, but should also handle module
 * configurations in the future.
 */
public interface ConfigService extends Service {
	/**
	 * Returns the relative working directory that should be used inside the
	 * current working directory. Currently only used during development, where
	 * the target directory is used for testing, while the working directory is
	 * the project directory.
	 * 
	 * @return Empty string when using normally, "target" when in development
	 *         mode.
	 */
	String getRelativeWorkingDirectory();

	/**
	 * Loads the given XML configuration file.
	 * 
	 * @param ircbotConfigurationFile
	 *            The file to parse and load.
	 * @throws SAXException
	 *             If there is something wrong with the schema file.
	 * @throws JAXBException
	 *             If the configuration file could not be parsed.
	 * @throws IOException
	 *             If the configuration file could not be found or XSD could not
	 *             be loaded.
	 */
	void loadConfiguration(File ircbotConfigurationFile) throws SAXException, JAXBException, IOException;

	/**
	 * Returns the parsed configuration as a tree of beans.
	 * 
	 * @return The complete configuration.
	 */
	IRCBot getConfiguration();
}
